<%@page import="java.util.Enumeration"%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://www.goodfox.com/jsp/tags/power" prefix="p"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
request.setAttribute("locale",request.getLocale());
%>
<style type="text/css">
	ul.rightTools {float:right; display:block;}
	ul.rightTools li{float:left; display:block; margin-left:5px}
</style>

<script type="text/javascript">

$(function () { 
	$("select.numPerPageSet").val('${numPerPage}');
	loadAccountIndexOrgTree("accountIndexOrgTree");
});

function loadAccountIndexOrgTree(orgTreeId){
	var orgArray="${act_query_orgArray}";
	$.ajax({
    	"dataType": "json",
    	"type": "POST",
    	"url": "<c:url value="/organization/organizationTreeQuery.shtml"/>",
    	"data": "",
    	async: false,
    	"success": function(data){
    		for(var i=0;i<data.orgList.length;i++){
    			var org =data.orgList[i];
    			var href="javascript;";
    			var isCheck="";
    			if(orgArray.indexOf(org.orgId)>=0){
    				isCheck="checked='true'";
    			}
    			if(org.orgId==data.curOrgId){
    				var topUl="<li><a href='javascript;' tname='act_query_orgList' tvalue='"+org.orgId+"' "+isCheck+">"+org.orgName+"</a><ul id='"+orgTreeId+"_"+org.orgId+"'></ul></li>";
    				if(org.subCount==0){
    					topUl="<li><a href='javascript;' tname='act_query_orgList' tvalue='"+org.orgId+"' "+isCheck+">"+org.orgName+"</a></li>";
    				}
    				$("#"+orgTreeId).append(topUl);
    			}else{
    				var ul="<li><a href='javascript;' tname='act_query_orgList' tvalue='"+org.orgId+"' "+isCheck+">"+org.orgName+"</a><ul id='"+orgTreeId+"_"+org.orgId+"'></ul></li>";
    				if(org.subCount==0){
    					ul="<li><a href='javascript;' tname='act_query_orgList' tvalue='"+org.orgId+"' "+isCheck+">"+org.orgName+"</a></li>";
    				}
    				$("#"+orgTreeId+"_"+org.orgIdParent).append(ul);
    			}
    		}
    	}
    }); 
}
function accountQuerySubmit(formObj){
	var orgIds="";
	$("input[name^='act_query_orgList']").each(function(){
		if($(this).attr("checked")=="checked"){
			orgIds+=$(this).attr("value")+";";
		}
	});
	$("#act_query_orgArray").attr("value",orgIds);
	return navTabSearch(formObj);
}
</script>
<div class="tabs">
	<div class="tabsHeader">
		<div class="tabsHeaderContent">
			<ul>
				<li><a href="javascript:;"><span>人员列表</span></a></li>
			</ul>
		</div>
	</div>
	<div class="tabsContent">
		<div>
			<div layoutH="140" class="contLeft">
				<ul id="accountIndexOrgTree" class="tree treeCheck">
				</ul>
			</div> 
			<div class="unitBox contRight">
				<form action="<c:url value="/account/goAccountIndex.shtml"/>" method="post" onsubmit="return accountQuerySubmit(this);">
				<div class="panel collapse">
					<h1>高级查询</h1>
					<div class="searchBar">
						<table class="searchContent">
							<tr>
								<td>
									姓名：
								</td>
								<td>
									<input type="text" name="act_query_memName" id="act_query_memName" value="${act_query_memName}">
									<input type="hidden" name="act_query_orgArray" id="act_query_orgArray" value="${act_query_orgArray}">
								</td>
								<td>
									用户名：
								</td>
								<td>
									<input type="text" name="act_query_actName" id="act_query_actName" value="${act_query_actName}">
								</td>
								<td>
									移动电话：
								</td>
								<td>
									<input type="text" name="act_query_memMobile" id="act_query_memMobile" value="${act_query_memMobile}">
								</td>
							</tr>
						</table>
						<div class="subBar">
							<ul>
								<li><div class="buttonActive"><div class="buttonContent"><button type="submit"><spring:message code="search.btnQuery"/></button></div></div></li>
							</ul>
						</div>
					</div>
				</div>
				</form>
				<div id="jbsxBox" class="unitBox">
					<div class="pageContent" style="border-left: 1px solid #B8D0D6;border-right: 1px solid #B8D0D6;">
						<div class="panelBar">
							<ul class="toolBar">
        						<c:if test="${p:isPower('/account/goAccountAdd.shtml',sessionScope.loginAccount)}">
								<li><a class="add" href="<c:url value="/account/goAccountAdd.shtml"/>" target="navTab" title="人员<spring:message code="search.lnkGoAdd"/>"><span><spring:message code="search.btnGoAdd"/></span></a></li>
								</c:if>
        						<c:if test="${p:isPower('/account/accountRemoveBat.shtml',sessionScope.loginAccount)}">
								<li><a class="delete" href="<c:url value="/account/accountRemoveBat.shtml"/>" target="selectedTodo" rel="actIds" title="确实要删除这些记录吗?"><span><spring:message code="search.btnRemoveBat"/></span></a></li>
								</c:if>
								<li class="line">line</li>
        						<c:if test="${p:isPower('/account/exportQuery.shtml',sessionScope.loginAccount)}">
								<li><a class="icon" href="<c:url value="/account/exportQuery.shtml"/>" target="dwzExport" targetType="navTab" rel="actIds" title="确实要导出这些记录吗?"><span><spring:message code="search.btnExportXls"/></span></a></li>
								</c:if>
							</ul>
						</div>
						<form id="pagerForm" method="post" action="<c:url value="/account/goAccountIndex.shtml"/>">
							<input type="hidden" name="pageNum" value="${pageNum}" />
							<input type="hidden" name="numPerPage" value="${numPerPage}" />
							<input type="hidden" name="act_query_orgArrayString" value="${act_query_orgArrayString}">
							<input type="hidden" name="act_query_memName" value="${act_query_memName}">
							<input type="hidden" name="act_query_actName" value="${act_query_actName}" />
							<input type="hidden" name="act_query_memMobile" value="${act_query_memMobile}" />
						</form>
						<table class="table" width="100%" layoutH="300">
							<thead>
								<tr>
									<th><input type="checkbox" group="actIds" class="checkboxCtrl"></th>
									<th>用户名</th>
									<th>姓名</th>
									<th>移动电话</th>
									<th>所属机构</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${actList}" var="act">
								<tr target="sid_user" rel="${act.actId}">
									<td><input name="actIds" value="${act.actId}" type="checkbox"></td>
									<td>${act.actName}</td>
									<td>${act.memName}</td>
									<td>${act.memMobile}</td>
									<td>${act.orgName}</td>
									<td>
        								<c:if test="${p:isPower('/account/goAccountDetail.shtml',sessionScope.loginAccount)}">
										<a title="人员<spring:message code="search.lnkGoDetail"/>" target="navTab" rel="actShowPage" href="<c:url value="/account/goAccountDetail.shtml"/>?actId=${act.actId}" class="btnView"><spring:message code="search.lnkGoDetail"/></a>
										</c:if>
        								<c:if test="${p:isPower('/account/goAccountModify.shtml',sessionScope.loginAccount)}">
										<a title="人员<spring:message code="search.lnkGoModify"/>"  target="navTab" rel="actShowPage" href="<c:url value="/account/goAccountModify.shtml"/>?actId=${act.actId}" class="btnEdit"><spring:message code="search.lnkGoModify"/></a>
										</c:if>
        								<c:if test="${p:isPower('/account/accountRemove.shtml',sessionScope.loginAccount)}">
										<a title="人员<spring:message code="search.lnkRemove"/>" target="ajaxTodo" href="<c:url value="/account/accountRemove.shtml"/>?actId=${act.actId}" class="btnDel"><spring:message code="search.lnkRemove"/></a>
										</c:if>
									</td>
								</tr>
								</c:forEach>
							</tbody>
						</table>
						<div class="panelBar">
							<div class="pages">
								<span>显示</span>
								<select class="numPerPageSet" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
									<option value="15">15</option>
									<option value="30">30</option>
									<option value="50">50</option>
								</select>
								<span>条，共${totalCount}条</span>
							</div>
							<div class="pagination" targetType="navTab" totalCount="${totalCount}" numPerPage="${numPerPage}" pageNumShown="5" currentPage="${currentPage}"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="tabsFooter">
		<div class="tabsFooterContent"></div>
	</div>
</div>